package cn.zymall.common.config.elsearch;

import org.apache.http.HttpHost;
import org.elasticsearch.client.RestClient;
import org.elasticsearch.client.RestHighLevelClient;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

/**
 * @author xuxianda
 * @Description: elsearch 配置类
 * @date 2020/8/16 11:49
 * @Copyright
 * @return
 **/
@Configuration
public class ElasticSearchConfig {

    @Bean
    public RestHighLevelClient getRestHighLevelClient() {
        RestHighLevelClient client = new RestHighLevelClient(
                //如果是集群再配置多个
                RestClient.builder(new HttpHost("120.25.210.114", 9200, "http"))
        );
        return client;
    }


//    @Bean
//    public ElasticsearchRestTemplate elasticsearchRestTemplate() {
//        RestHighLevelClient client = new RestHighLevelClient(
//                //如果是集群再配置多个
//                RestClient.builder(new HttpHost("120.25.210.114", 9200, "http"))
//        );
//        ElasticsearchRestTemplate elasticsearchRestTemplate = new ElasticsearchRestTemplate(client);
//        return elasticsearchRestTemplate;
//    }

}
